package org.testis.gui.mvc.model.testdesign;

import org.testis.gui.mvc.model.*;
import org.testis.gui.mvc.controller.testdesign.TestCaseGroupController;
import java.util.HashMap;

/**
 *
 * @author Cahit Emir Erel
 */
public class TestCaseGroupModel extends AbstractModel {

    private Boolean m_testCaseGroupVisibility = false;
    private Boolean m_runAlways = false;
    private Integer m_timeout = 0;
    private String m_name = "";
    private String m_description = "";

    public String getName() {
        return m_name;
    }

    public void setName(String name) {
        if (name == null) {
            name = "";
        }
        String oldName = m_name;
        m_name = name;
        firePropertyChange(TestCaseGroupController.CHANGE_NAME,
                oldName,
                name);
    }

    public String getDescription() {
        return m_description;
    }

    public void setDescription(String description) {
        if (description == null) {
            description = "";
        }
        String oldDescription = m_description;
        m_description = description;
        firePropertyChange(TestCaseGroupController.CHANGE_DESCRIPTION,
                oldDescription,
                description);
    }

    public void setTestCaseGroupVisibility(Boolean testCaseGroupVisibility) {
        if (testCaseGroupVisibility == null) {
            return;
        }
        Boolean oldTestCaseGroupVisibility = m_testCaseGroupVisibility;
        m_testCaseGroupVisibility = testCaseGroupVisibility;
        firePropertyChange(TestCaseGroupController.SHOW_ADD_TEST_CASE_GROUP,
                oldTestCaseGroupVisibility,
                testCaseGroupVisibility);
    }

    public Boolean getTestCaseGroupVisibility() {
        return m_testCaseGroupVisibility;
    }

    public Boolean getRunAlways() {
        return m_runAlways;
    }

    public void setRunAlways(Boolean runAlways) {
        if (runAlways == null) {
            return;
        }
        Boolean oldRunAlways = m_runAlways;
        m_runAlways = runAlways;
        firePropertyChange(TestCaseGroupController.CHANGE_RUN_ALWAYS,
                oldRunAlways,
                runAlways);
    }

    public Integer getTimeout() {
        return m_timeout;
    }

    public void setTimeout(Integer timeout) {
        if (timeout == null) {
            return;
        }
        Integer oldTimeout = m_timeout;
        m_timeout = timeout;
        firePropertyChange(TestCaseGroupController.CHANGE_TIMEOUT,
                oldTimeout,
                timeout);
    }
}
